package 周赛;

import org.junit.Test;

import java.util.Arrays;

public class 找出缺失的观测数据 {

    public int[] missingRolls(int[] rolls, int mean, int n) {
        int m = rolls.length;
        int sum = (m+n)*mean;
        int mSum = Arrays.stream(rolls).sum();
        int nSum = sum-mSum;
        double avg =(double)nSum / n;
        if (avg > 6 || avg < 1){
           return new int[]{};
        }
        int[] ints = new int[n];
        int yu = nSum % n;
        for (int i = 0; i < n; i++) {
            if (yu!=0){
                ints[i] = nSum / n+1;
                yu--;
            }
            else
                ints[i] = nSum / n;
        }
        return ints;
    }
    @Test
    public void test(){
        double n =(double) 19/3;
        if (n>6)
            System.out.println("123");
    }
}
